package com.gmail.viktor.yuryev.model;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by access_user on 4/19/2014.
 */
public class Link {
    private Path local;
    private Path remote;

    public Link() {
        super();
    }

    public Link(Path local, Path remote) {
        this.local = local;
        this.remote = remote;
    }

    public Link(String local, String remote) {
        this.local = Paths.get(local);
        this.remote = Paths.get(remote);
    }



    public Link clone(){
        return new Link(local, remote);
    }

    @Override
    public String toString() {
        return "Link{" +
                "local='" + local + '\'' +
                ", remote='" + remote + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Link link = (Link) o;

        if (local != null ? !local.equals(link.local) : link.local != null) return false;
        if (remote != null ? !remote.equals(link.remote) : link.remote != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = local != null ? local.hashCode() : 0;
        result = 31 * result + (remote != null ? remote.hashCode() : 0);
        return result;
    }

    public Path getLocalFolder() {
        return local;
    }

    public Path getRemoteFolder() {
        return remote;
    }


    public void setLocalFolder(String value) {
        this.local = Paths.get(value);
    }

    public void setRemoteFolder(String value) {
        this.remote = Paths.get(value);
    }
}
